- Quiz III: Thursday April 9
To be announced later (material)

- Exam II: Thursday April 16
Material is to be announced later

- Case study: 
Read data from a file (Scanner: iterator) ---> Iterators: hasNext and next
Write data to a file (classes from java.io package: 
FileWriter, BufferedWriter, PrintWriter).

- Problem solving

1. Check if a given number is a power of 2

Optimal solution: time complexity O(1) and space complexity O(1)

Hint: to achieve the optimal solution ---> We use bitwise operators (&)

Application#1: IsPowerOfTwo

2. Fibonacci sequence:

0	1	1	2	3 ...etc

fib(0) = 0
fib(1) = 1
....
fib(n)

Many different solutions: a) Recursive; b) suboptimal solution based on memoisation
c) Dynamic programming (Optimal solution)
n
0	1		2			3 (position)
0	1		1			2
preprev prev	current = prevprev + prev
	prevprev	prev

BigInteger - BigDecimal

Application#2: Fibonacci

- Scanner problem:


Application#3: Scanner problem

- Null pointer exception problem

Application#4: NullPointerProblem

- Is whole problem

Enter a numeric value: 4.5
The input is not a whole number

Enter a numeric value: 4
The input is a whole number

How to compare double values? floating point errors
double val1, val2; // initialized properly
Double.compare(val1, val2) == 0 ===> val1 is equal to val2

Math.abs(val1 - val2) < E-10

if(val % 1 == 0) ===> val is a whole number

codeforces (competitive programming)

---------------------------------------------------------------
Chapter 6 (older version of the book)
Chapter 7 (newer version of the book)

Class relationships

Topic#1: static variables and static methods

Application#5: 
Driver class: MultiSlogans.java
Helper class: Slogan.java

Aim: create multiple solgan objects and then print the count out

Slogan slg1 = new Slogan("Just do it!");
slg1:							count: 3
phrase = "Just do it!"


Slogan slg2 = new Slogan("Live free or die");
slg2:
phrase = "Live free or die"

Slogan slg3 = new Slogan("Do not worry, be happy");
phrase = "...."








































